<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
<title>字典管理</title>
<meta name="decorator" content="default"/>
<tags:import includes="spinner,bootbox"></tags:import>
<script src="${ctxStatic}/modules/sys/commons/dict.js"></script>
<script>
function page(n,s){
	$("#pageNo").val(n);
	$("#pageSize").val(s);
	$("#frmSearch").submit();
	return false;
}
</script>
</head>
<body>
	<br>
	<form id="frmSearch" modelAttribute="dict" action="${ctx}/sys/dict/" method="post" class="breadcrumb form-search">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>		
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>			
		<label>类型：</label><widgets:select all="true"  value="${dict.type}" datasource="${fns:getAllDictType()}"  dictName="type" dispVar="type" dataPlaceholder="字典类型"></widgets:select>
		&nbsp;&nbsp; <label>标签 ：</label><input type="text" value="${dict.label}" name="label" htmlEscape="false" maxlength="50" class="input-medium"/>
		&nbsp;<input id="btnQuery" class="btn btn-success"" type="submit" value="查询"/>
		&nbsp;<input id="btnNew" class="btn" type="button" value="新增"/>
		&nbsp;<button id="btnDelete" class="btn" type="button" >删除</button>
		&nbsp;<button id="btnRstCache" class="btn" type="button" >重置缓存</button>		
	</form>
	<br><br>
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
		<thead>
			<tr>
				<th class="center" style="width: 50px;"><label> <input
						type="checkbox" class="ace" /> <span class="lbl"></span>
				</label>
				</th>
				<th>标签</th>
				<th>键值</th>
				<th>类型</th>
				<th>描述</th>
				<th>排序</th>
				<th>操作</th>
			</tr>
		</thead>
		<tbody>
		<c:forEach items="${page.list}" var="dict">
			<tr>
				<td class="center"><label><input value="${dict.id}" type="checkbox"
										class="ace" /> <span class="lbl"></span></label>
				</td>
				<td><a href="${ctx}/sys/dict/form?id=${dict.id}">${dict.label}</a></td>
				<td>${dict.value}</td>
				<td><a href="javascript:" onclick="$('#type').val('${dict.type}');$('#searchForm').submit();return false;">${dict.type}</a></td>
				<td>${dict.description}</td>
				<td>${dict.sort}</td>
				<td>
					<a href="javascript:onDelete('${dict.id}')">删除</a>
					<a href="javascript:onUpdate('${dict.id}')">编辑</a>					
				</td>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	${page}	
	<!-- 模态窗体 -->
	<div id="modalTable" action="new" class="modal fade" tabindex="-1" style="display:none;width: 402px;height: 335px;">
		<div class="modal-dialog">
			<div class="modal-content" style="width: 400px; height: 300px;">
				<div class="modal-header no-padding">
					<div class="table-header">
						<button type="button" class="close" data-dismiss="modal"
							aria-hidden="true">
							<span class="white">&times;</span>
						</button>
						<span id='modalTitle'>新增窗体</span>
					</div>
				</div>

				<!-- 新增窗体内部 -->
				<form id="frmSubmit" class="form-horizontal" role="form"
					method="post">
					<input type="hidden" name="userId" value="${userId}" uname="update"/> 
					<input type="hidden" name="id" uname="update"/>
							
					<div class="space-4"></div>
					<div class="form-group">
						<label class="col-sm-3 control-label no-padding-right">标签名称</label>
						<div class="col-sm-9">
							<input type="text" class="col-xs-10"
								name="label" uname="update"/>
						</div>
					</div>

					<div class="form-group">
						<label class="col-sm-3 control-label no-padding-right">值</label>
						<div class="col-sm-9">
							<input type="text" class="col-xs-10"
								name="value" uname="update"/>
						</div>
					</div>

					<div class="form-group">
						<label class="col-sm-3 control-label no-padding-right">字典类型</label>
						<div class="col-sm-9">
							<input type="text" class="col-xs-10"
								name="type" uname="update"/>
						</div>
					</div>
					
					<div class="form-group">
						<label class="col-sm-3 control-label no-padding-right">描述</label>
						<div class="col-sm-9">
							<input type="text" class="col-xs-10"
								name="description" uname="update"/>
						</div>
					</div>
					
					<div class="form-group">
						<label class="col-sm-3 control-label no-padding-right"
							for="form-field-1"> 排序 </label>

						<div class="col-sm-9">
							<input style="width: 195px;" type="text"  placeholder="数字越大，排序越靠前"
								class="col-xs-10 col-sm-5" id="sort" name="sort" uname="update"/>
						</div>
					</div>

					<div class="space-4"></div>
					<div class="clearfix form-actions">
						<div class="center">
							<button id="btnSubmit" class="btn btn-info" type="button">
								<i class="icon-ok bigger-110"></i> 保存
							</button>
							&nbsp; &nbsp; &nbsp;
							<button class="btn" type="reset">
								<i class="icon-undo bigger-110"></i> 重置
							</button>
						</div>
					</div>
				</form>
				<!-- PAGE CONTENT ENDS -->
			</div>
			<!-- /.modal-content -->
		</div>
		<!-- /.modal-dialog -->
	</div>
</body>
</html>